ImapFolderAgent: Do not fail when port is blank.

Akinori MUSHA 10 years ago
parent
commit
280c09415e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/models/agents/imap_folder_agent.rb

+ 2 - 1
app/models/agents/imap_folder_agent.rb

@@ -302,9 +302,10 @@ module Agents
302 302
     def each_unread_mail
303 303
       host, port, ssl, username = interpolated.values_at(:host, :port, :ssl, :username)
304 304
       ssl = boolify(ssl)
305
+      port = (Integer(port) if port.present?)
305 306
 
306 307
       log "Connecting to #{host}#{':%d' % port if port}#{' via SSL' if ssl}"
307
-      Client.open(host, Integer(port), ssl) { |imap|
308
+      Client.open(host, port, ssl) { |imap|
308 309
         log "Logging in as #{username}"
309 310
         imap.login(username, interpolated[:password])
310 311